package oj;

import java.util.*;

public class Day37F {
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        while(sc.hasNext()){
            int n=sc.nextInt();
            Set<String> pool=new HashSet<>();
            int cur=0,max=0;
            for(int i=0;i<n;i++){
                String name=sc.next();
                String sta=sc.next();
                if(!pool.contains(name)&&"connect".equals(sta)){
                    pool.add(name);
                    cur++;
                    max=Math.max(max,cur);
                }
                if(pool.contains(name)&&"disconnect".equals(sta)){
                    pool.remove(name);
                    cur--;
                }
            }
            System.out.println(max);
        }
    }
}
